package server;
import com.sun.net.httpserver.HttpServer;
import ioc.BeanFactory;

import java.io.IOException;
import java.net.InetSocketAddress;

public class SimpleHttpServer {

    public static void main(String[] args) throws IOException {
        BeanFactory.loadXMLFile("beans.xml");
        HttpServer server = HttpServer.create(new InetSocketAddress(8080), 0);
        server.createContext("/", new MyHandler());
        server.setExecutor(null); // 使用默认的线程池
        server.start();
        System.out.println("Server is listening on port 8080");
    }
}